package cn.jy.careuplusdoctor.adapter;

import java.util.List;

import cn.jy.careuplusdoctor.R;
import cn.jy.careuplusdoctor.entity.Sicker;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SickerAdapter extends BaseAdapter{
	
	private Context context;
	private List<Sicker> datas;
	public SickerAdapter(Context context,List<Sicker> datas) {
		this.context = context;
		this.datas = datas;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return datas.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return datas.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(R.layout.list_item_sicker, null);
		}
		TextView tvSickerName = ViewHolder.findView(convertView, R.id.tv_sicker_name);
		Sicker sicker = datas.get(position);
		tvSickerName.setText(sicker.getName());
		
		return convertView;
	}

}
